=========================================================================== BBS: The Abacus * HST/DS * Potterville, MI Date: 06-08-93 (03:06) Number: 204 From: RICH GELDREICH Refer#: NONE To: CALVIN FRENCH Recvd: NO Subj: Gif Loader/4 Conf: (35) Quick Basi --------------------------------------------------------------------------- '>>> Start of page 4. 'BSAVE "pic.bas", 0, 64768 'Load images saved with the above code with this: 'DEF SEG= &HA000 'BLOAD "Pic.Bas" 'OUT &H3C8, 0 'FOR a = 0 To 767 ' OUT &H3C9, Peek(a+ 64000) 'NEXT BEEP: DO: LOOP WHILE INKEY$ <> "": DO: LOOP UNTIL INKEY$ <> "" END 'Slowly reads one byte from the GIF file... GetByte: A$ = " ": GET #1, , A$: A = ASC(A$): RETURN 'Moves down one scanline. If the GIF is interlaced, then the number 'of scanlines skipped is based on the current pass. NextScanLine: IF Interlaced THEN y = y + PassStep IF y >= YEnd THEN PassNumber = PassNumber + 1 SELECT CASE PassNumber CASE 1: y = 4: PassStep = 8 CASE 2: y = 2: PassStep = 4 CASE 3: y = 1:ŠassStep = 2 END SELECT END IF ELSE y = y + 1 END IF X = XStart: YBase = y * 320& RETURN 'Reads a multibit code from the data stream. Look ma, see how 'simple it is now! GetCode: WorkCode = LastChar \ ShiftOut(BitsIn) 'Loop while more bits are needed. DO WHILE CodeSize > BitsIn 'Reads a byte from the LZW data stream. Since the data stream is 'blocked, a check is performed for the end of the current block 'before each byte is fetched. IF BlockPointer > BlockSize THEN 'Retrieve block's length GOSUB GetByte: BlockSize = A A$ = SPACE$(BlockSize): GET #1, , A$ BlockPointer = 1 END IF 'Yuck, ASC() and MID$() aren't that fast. LastChar = ASC(MID$(A$, BlockPointer, 1)) BlockPointer = BlockPointer + 1 'Append 8 more bits to the input buffer WorkCode = WorkCode OR LastChar * Powersof2(BitsIn) BitsIn = BitsIn + 8 LOOP 'Take away x number of bits. BitsIn = BitsIn - CodeSize 'Return code to caller. Code = WorkCode AND MaxCode RETURN '______O_/__________________| SNIP |__________________\_O______ ' O \ | HERE | / O Have fun Calvin! Rich --- MsgToss 2.0b * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209 SEEN-BY: 261/1023 280/1 390/1 396/1 15 397/2 2230/100 2440/5 3603/20